import java.util.Timer;
import java.util.TimerTask;

public class ThreadDemo16 {
    public static void main(String[] args) {
        Timer timer = new Timer();//创建一个计时器
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("开始计时器任务");
            }
        },3000);
        System.out.println("主线程任务");
    }
}
